using System;
using System.Web;
using System.Drawing;
using System.Web.UI;
using System.Web.UI.WebControls	;

namespace WroxControls 
{
   public class MyLabel : Control
   {
      string _text;

      public string Text
      {
         get{ return _text; }
         set{ _text = value; }  
      }

      int _repeatCount = 1;
 
      public int RepeatCount
      {
         get { return _repeatCount; }
         set { _repeatCount = value; }
      }

		Style _style = new Style();
      public Style LabelStyle
      {
         get { return _style; }
      }
		
      public Color ForeColor
      {
         get { return _style.ForeColor; }
         set { _style.ForeColor = value; }
      }

      protected override void OnInit(EventArgs e)
      {
         if ( _text == null )
             _text = "Here is some default text";
      }

      protected override void Render(HtmlTextWriter writer) 
      { 
         int loop;
         for( loop=0; loop < _repeatCount; loop++ )
         {

				_style.AddAttributesToRender( writer );
            writer.RenderBeginTag("h1");
            writer.Write( _text );
            writer.RenderEndTag();
         }
      }

   }
};
